<script type="text/javascript">

</script>
<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
	<div class="container">
		<a class="brand pull-left" href="/">ISO</a>
		<div class="nav-collapse collapse navbar-inverse-collapse">
				<?php
					if($_SESSION['UserAuth']['User']){
				?>
					 <ul class="nav pull-right">
						<li class="dropdown">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">Hi, <?php echo $_SESSION['UserAuth']['User']['first_name'].' '.$_SESSION['UserAuth']['User']['last_name'];?> <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li><a href="/logout">Sign Out</a></li>
							</ul>
						</li>
					</ul>
				<?php
					}else{
				?>
						<ul class="nav pull-right">
							<li id="google" class="btn btn-primary" title='Gmail Connect' onclick="javascript:login_popup('gmail');return false;">Sign In</li>
						</ul>
				<?php	
					}
				?>
			<?php
				if($_SESSION['UserAuth']['User']){
			?>
			<ul class="nav">
				<li><a href="/documents">Documents</a></li>
			</ul>
			<form class="navbar-search pull-left" action='/documents/searchFile' method='post'>
				<input type="text" class="search-query" placeholder="Search" name='data[Document][q]'>
			</form>
			<?php
				}
			?>
		</div>
	</div>
  </div>
</div>
<script language="JavaScript">
var newwindow;
function login_popup(url) {
	var  screenX    = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
	screenY    = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
	outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
	outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
	width    = 500,
	height   = 500,
	left     = parseInt(screenX + ((outerWidth - width) / 2), 10),
	top      = parseInt(screenY + ((outerHeight - height) / 2.5), 10),
	features = (
		'width=' + width +
		',height=' + height +
		',left=' + left +
		',top=' + top+
		',scroll=yes'
	);
	if(url=='fs' || url=='twt') {
		newwindow=window.open('login/'+url,'_self');
	} else {
		newwindow=window.open('login/'+url,'',features);
	}
	if (window.focus) {
		newwindow.focus()
	}
	return false;
}
</script>
